/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package client;

/**
 *
 * @author sun
 */
public class ClientMain {

    String name;
    LogPanel lp;
    NewClientKernel kc = new NewClientKernel();
    int state = 0;

    public void nt() {
        kc.setMyName(name);
        
    }

    public ClientMain() {

        kc.start();
        while (state == 0) {
            lp = new LogPanel();
            String[] var;
            switch (lp.k()) {
                case 1:
                    //login
                    var = lp.getNP();
                    name = var[0];
                    String pass = var[1];
                    if (kc.login(name, pass)) {
                        state = 1;
                        nt();

                    }
                    break;
                case 2:
                    System.exit(0);
                    break;
                case 3:
                  
                    var = lp.getRNP();
                    name = var[0];
                    String pass1 = var[1];
                    if (kc.regist(name, pass1)) {
                        if (kc.login(name, pass1)) {
                            state = 1;
                            nt();

                        }
                    }
                    break;
            }

        }
    }

    public static void main(String[] args) {
        ClientMain cm = new ClientMain();
    }
}
